using System;
using System.Reflection;

namespace Sunny.UI;

public static class AssemblyEx
{
	public static Type GetCurrentType(string typename)
	{
		return Assembly.GetExecutingAssembly().GetType(typename);
	}

	public static Type GetDllType(string dll, string typename)
	{
		return Assembly.LoadFile(dll).GetType(typename);
	}

	public static Type[] GetCurrentTypes()
	{
		return Assembly.GetExecutingAssembly().GetTypes();
	}

	public static Type[] GetDllTypes(string dll)
	{
		return Assembly.LoadFile(dll).GetExportedTypes();
	}

	public static object CreateInstance(this Type type)
	{
		return Activator.CreateInstance(type);
	}
}
